package com.zhuss.${moudle}.${tablePkg};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.${moudle}.${tablePkg}.Create${poEntity}Bo;
import com.zhuss.bean.bo.${moudle}.${tablePkg}.Delete${poEntity}Bo;
import com.zhuss.bean.bo.${moudle}.${tablePkg}.Update${poEntity}Bo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.OceanException;

/**
 * @description: ${tableComment}操作的Service
 * @author: zhushanshuo
 * @create: ${creatTime}
 **/
@Component("${poEntityLower}OperateService")
public class ${poEntity}OperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("${poEntityLower}Create")
	private Processor<Object, Create${poEntity}Bo> ${poEntityLower}Create;
	
	@Autowired
	@Qualifier("${poEntityLower}Update")
	private Processor<Object, Update${poEntity}Bo> ${poEntityLower}Update;
	
	@Autowired
	@Qualifier("${poEntityLower}Delete")
	private Processor<Object, Delete${poEntity}Bo> ${poEntityLower}Delete;
	
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws OceanException {
		
		Create${poEntity}Bo bo = (Create${poEntity}Bo) param;
		
		${poEntityLower}Create.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws OceanException {
    	
		Update${poEntity}Bo bo = (Update${poEntity}Bo) param;
		
		${poEntityLower}Update.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws OceanException {
		
		Delete${poEntity}Bo bo = (Delete${poEntity}Bo) param;
		
		${poEntityLower}Delete.process(bo);
		
		return null;
	}
	
}

